package com.eduadmin.service;

import com.eduadmin.entity.Statistics;
import com.eduadmin.mapper.StatisticsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatisticsServiceImpl implements IStatisticsService {
    private final StatisticsMapper statisticsMapper;

    @Autowired
    public StatisticsServiceImpl(StatisticsMapper statisticsMapper) {
        this.statisticsMapper = statisticsMapper;
    }

    @Override
    public List<Statistics> getAllStatistics() {
        return statisticsMapper.getAllStatistics();
    }

    @Override
    public int addStatistics(List<Statistics> statisticsList) {
        return statisticsMapper.insertStatistics(statisticsList);
    }

    @Override
    public Statistics getStatistics(Statistics statistics) {
        return statisticsMapper.selectStatistics(statistics);
    }

    public String getStatisticsNameByParam(String statisticsTableName){
       return statisticsMapper.getStatisticsNameByParam(statisticsTableName);
    }
}
